
var base = null
var utils = null
var azurCtrl = null
func _ready():
	pass
func _init():
	call_deferred("init")
	pass
func _connect():
	pass

func init():
	if globalData.infoDs.has("g_azurlaneBase"):
		base = globalData.infoDs["g_azurlaneBase"]
	if base != null:
		#初始化
		utils = globalData.infoDs["g_azurlaneUtils"]
		azurCtrl = globalData.infoDs["g_azurlane"]
#live2D缓存
var cache = {}
func getLive(name):
	var animate = AnimatedSprite.new()
	animate.name = "l2d"
	animate.speed_scale = 2
	animate.position = Vector2(1250, 300)
	animate.frames = SpriteFrames.new()
	animate.frames.add_animation("def")
	animate.z_index = 4096
	var imgs = []
	if !cache.has(name):
		var dirStr = sys.getBasePath() + "/l2d/" + name
		var dir = Directory.new()
		dir.open(dirStr)
		dir.list_dir_begin(true, true)
		var file = File.new()
		var dname = dir.get_next()
		while dname != "":
			if not dir.current_is_dir() and dname.find(".jpg") > -1:
				var img = base.loadImg(dirStr, dname)
				imgs.append(img)
				animate.frames.add_frame("def", img)
			dname = dir.get_next()
		dir.list_dir_end()
		cache[name] = imgs
	else:
		for i in cache.get(name):
			animate.frames.add_frame("def", i)
	return animate

var animeCache = {}